<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>会员综合分析报告</title>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary: #1a73e8;
            --secondary: #34a853;
            --accent: #ea4335;
            --highlight: #fbbc04;
            --light-blue: #4285f4;
            --dark-blue: #1967d2;
            --text-dark: #202124;
            --text-medium: #5f6368;
            --bg-light: #f8f9fa;
            --white: #ffffff;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Roboto', 'Microsoft YaHei', sans-serif;
            line-height: 1.6;
            color: var(--text-dark);
            background-color: var(--bg-light);
            -webkit-font-smoothing: antialiased;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        /* 封面样式 */
        .cover {
            height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, var(--primary), var(--dark-blue));
            color: var(--white);
            text-align: center;
            padding: 40px;
            position: relative;
            overflow: hidden;
        }

        .cover::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="none" width="100" height="100"/><path fill="rgba(255,255,255,0.05)" d="M30,10L50,30L70,10L90,30L70,50L90,70L70,90L50,70L30,90L10,70L30,50L10,30L30,10Z"/></svg>');
            opacity: 0.1;
        }

        .cover h1 {
            font-size: 3.5rem;
            font-weight: 700;
            margin-bottom: 20px;
            position: relative;
            animation: fadeInDown 1s ease;
        }

        .cover .subtitle {
            font-size: 1.5rem;
            font-weight: 300;
            margin-bottom: 40px;
            position: relative;
            animation: fadeIn 1.5s ease;
        }

        .cover .date {
            font-size: 1rem;
            margin-bottom: 60px;
            position: relative;
            animation: fadeIn 2s ease;
        }

        .cover .scroll-down {
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            animation: bounce 2s infinite;
            cursor: pointer;
        }

        /* 报告内容样式 */
        .report {
            background-color: var(--white);
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            padding: 40px;
            margin-bottom: 40px;
            position: relative;
            overflow: hidden;
        }

        .report::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 5px;
            height: 100%;
            background: linear-gradient(to bottom, var(--primary), var(--secondary));
        }

        .section-title {
            font-size: 2rem;
            color: var(--primary);
            margin: 40px 0 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid var(--bg-light);
            position: relative;
        }

        .section-title::after {
            content: "";
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 100px;
            height: 2px;
            background-color: var(--primary);
        }

        .subsection-title {
            font-size: 1.5rem;
            color: var(--text-dark);
            margin: 30px 0 15px;
        }

        .chart-container {
            position: relative;
            margin: 30px auto;
            width: 100%;
            height: 400px;
            transition: all 0.3s ease;
        }

        .chart-container:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }

        .data-card {
            background-color: var(--white);
            border-radius: 8px;
            padding: 20px;
            margin: 20px 0;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            border-left: 4px solid var(--primary);
            transition: all 0.3s ease;
        }

        .data-card:hover {
            transform: translateX(5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .data-card.warning {
            border-left-color: var(--highlight);
            background-color: rgba(251, 188, 4, 0.05);
        }

        .data-card.danger {
            border-left-color: var(--accent);
            background-color: rgba(234, 67, 53, 0.05);
        }

        .data-card.success {
            border-left-color: var(--secondary);
            background-color: rgba(52, 168, 83, 0.05);
        }

        .key-finding {
            background-color: rgba(26, 115, 232, 0.1);
            border-left: 4px solid var(--primary);
            padding: 15px;
            margin: 20px 0;
            border-radius: 0 4px 4px 0;
            position: relative;
        }

        .key-finding::before {
            content: "★";
            position: absolute;
            left: -25px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--highlight);
            font-size: 1.5rem;
        }

        /* 目录样式 */
        .toc {
            position: fixed;
            top: 50%;
            right: 20px;
            transform: translateY(-50%);
            background-color: var(--white);
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            padding: 20px;
            z-index: 100;
            max-height: 80vh;
            overflow-y: auto;
            display: none;
        }

        .toc-title {
            font-size: 1.2rem;
            font-weight: 500;
            margin-bottom: 15px;
            color: var(--primary);
            border-bottom: 1px solid var(--bg-light);
            padding-bottom: 10px;
        }

        .toc-list {
            list-style: none;
        }

        .toc-item {
            margin: 8px 0;
        }

        .toc-link {
            color: var(--text-medium);
            text-decoration: none;
            transition: all 0.2s ease;
            display: block;
            padding: 5px 0;
        }

        .toc-link:hover {
            color: var(--primary);
            transform: translateX(5px);
        }

        /* 工具按钮 */
        .toolbar {
            position: fixed;
            bottom: 20px;
            right: 20px;
            display: flex;
            gap: 10px;
            z-index: 100;
        }

        .tool-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: var(--primary);
            color: var(--white);
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            border: none;
            outline: none;
        }

        .tool-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
        }

        .tool-btn.secondary {
            background-color: var(--secondary);
        }

        .tool-btn.accent {
            background-color: var(--accent);
        }

        /* 动画 */
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes fadeInDown {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes bounce {
            0%, 20%, 50%, 80%, 100% { transform: translateY(0) translateX(-50%); }
            40% { transform: translateY(-20px) translateX(-50%); }
            60% { transform: translateY(-10px) translateX(-50%); }
        }

        /* 打印样式 */
        @media print {
            body {
                background-color: transparent;
                font-size: 12pt;
                line-height: 1.4;
            }

            .cover {
                height: auto;
                page-break-after: always;
                background: none;
                color: #000;
            }

            .report {
                box-shadow: none;
                page-break-inside: avoid;
            }

            .toolbar, .toc {
                display: none !important;
            }

            .chart-container {
                height: 300px;
                page-break-inside: avoid;
            }

            @page {
                size: A4;
                margin: 1.5cm;
            }
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                padding: 10px;
            }

            .report {
                padding: 20px;
            }

            .section-title {
                font-size: 1.8rem;
            }

            .chart-container {
                height: 300px;
            }

            .toc {
                display: none !important;
            }
        }
    </style>
</head>
<body>
    <!-- 封面 -->
    <div class="cover" id="cover">
        <h1>会员综合分析报告</h1>
        <div class="subtitle">数据驱动的会员洞察与策略建议</div>
        <div class="date">生成日期: 2025年4月30日</div>
        <div class="scroll-down" onclick="scrollToContent()">
            <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <path d="M12 5v14M19 12l-7 7-7-7"/>
            </svg>
        </div>
    </div>

    <div class="container">
        <!-- 目录 -->
        <div class="toc" id="toc">
            <div class="toc-title">目录</div>
            <ul class="toc-list">
                <li class="toc-item"><a href="#gender" class="toc-link">1. 性别分布</a></li>
                <li class="toc-item"><a href="#age" class="toc-link">2. 年龄分布</a></li>
                <li class="toc-item"><a href="#education" class="toc-link">3. 学历层次</a></li>
                <li class="toc-item"><a href="#marriage" class="toc-link">4. 婚姻状态</a></li>
                <li class="toc-item"><a href="#union" class="toc-link">5. 工会分布</a></li>
                <li class="toc-item"><a href="#group" class="toc-link">6. 小组分布</a></li>
                <li class="toc-item"><a href="#institution" class="toc-link">7. 机构分布</a></li>
            </ul>
        </div>

        <!-- 工具按钮 -->
        <div class="toolbar">
            <button class="tool-btn" title="显示目录" onclick="toggleToc()">
                <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <line x1="3" y1="12" x2="21" y2="12"></line>
                    <line x1="3" y1="6" x2="21" y2="6"></line>
                    <line x1="3" y1="18" x2="21" y2="18"></line>
                </svg>
            </button>
            <button class="tool-btn secondary" title="导出PDF" onclick="exportToPDF()">
                <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
                    <polyline points="7 10 12 15 17 10"></polyline>
                    <line x1="12" y1="15" x2="12" y2="3"></line>
                </svg>
            </button>
            <button class="tool-btn accent" title="返回顶部" onclick="scrollToTop()">
                <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <path d="M18 15l-6-6-6 6"/>
                </svg>
            </button>
        </div>

        <!-- 报告内容 -->
        <div class="report">
            <h2 class="section-title" id="gender">1. 性别分布</h2>
            
            <div class="chart-container">
                <canvas id="genderChart"></canvas>
            </div>
            
            <div class="key-finding">
                <strong>关键发现：</strong> 男性会员占比61.12%，显著高于女性会员的38.88%，反映出会员群体的性别结构特征。
            </div>
            
            <div class="data-card warning">
                <h3 class="subsection-title">数据可靠性提示</h3>
                <p>当前数据仅包含2条记录，数据量过少可能导致分析结果的偏差。建议在后续分析中增加数据量，以提高分析的准确性和可靠性。</p>
            </div>
            
            <div class="data-card">
                <h3 class="subsection-title">业务洞察</h3>
                <ul>
                    <li><strong>性别平衡：</strong> 考虑到男性会员占比较高，建议进一步分析男性会员的具体需求和偏好，以优化会员服务。</li>
                    <li><strong>数据扩展：</strong> 为提升分析的可靠性，建议收集更多性别分布数据，并结合其他维度（如年龄、职业等）进行交叉分析。</li>
                </ul>
            </div>
        </div>

        <div class="report">
            <h2 class="section-title" id="age">2. 年龄分布</h2>
            
            <div class="chart-container">
                <canvas id="ageChart"></canvas>
            </div>
            
            <div class="key-finding">
                <strong>关键发现：</strong> 会员年龄主要集中在31-45岁区间(48.0%)，其次是46-60岁(25.8%)和19-30岁(24.4%)，60岁以上仅占1.6%。
            </div>
            
            <div class="data-grid">
                <div class="data-card success">
                    <h4>核心群体</h4>
                    <p>31-45岁 (48.0%)</p>
                    <p>职业稳定性和消费能力突出</p>
                </div>
                <div class="data-card">
                    <h4>潜力群体</h4>
                    <p>19-30岁 (24.4%)</p>
                    <p>年轻一代参与热情高</p>
                </div>
                <div class="data-card">
                    <h4>成熟群体</h4>
                    <p>46-60岁 (25.8%)</p>
                    <p>健康意识和参与度较高</p>
                </div>
            </div>
            
            <div class="data-card">
                <h3 class="subsection-title">营销建议</h3>
                <ul>
                    <li><strong>目标市场：</strong> 重点针对31-45岁核心群体制定营销策略</li>
                    <li><strong>潜在机会：</strong> 开发适合19-30岁和46-60岁年龄段的产品或服务</li>
                    <li><strong>风险提示：</strong> 60岁以上会员参与度低，需了解需求障碍</li>
                </ul>
            </div>
        </div>

        <div class="report">
            <h2 class="section-title" id="education">3. 学历层次</h2>
            
            <div class="chart-container">
                <canvas id="educationChart"></canvas>
            </div>
            
            <div class="key-finding">
                <strong>关键发现：</strong> 博士研究生占比65.93%，硕士研究生25.25%，本科及以下不足10%，学历层次呈现明显高端化趋势。
            </div>
            
            <div class="data-card success">
                <h3 class="subsection-title">高学历优势</h3>
                <p>博士和硕士会员占比超过90%，在专业知识和研究能力方面具有显著优势，可推动技术创新和学术研究。</p>
            </div>
            
            <div class="data-card warning">
                <h3 class="subsection-title">多样性挑战</h3>
                <p>其他学历层次会员数量较少，可能在某些岗位上存在人才短缺风险，建议在招聘和培训中注重学历层次多样性。</p>
            </div>
        </div>

        <div class="report">
            <h2 class="section-title" id="marriage">4. 婚姻状态</h2>
            
            <div class="chart-container">
                <canvas id="marriageChart"></canvas>
            </div>
            
            <div class="key-finding">
                <strong>关键发现：</strong> 已婚会员占比59.2%，未婚37.8%，其他婚姻状态合计3%，反映了会员群体的基本婚姻构成。
            </div>
            
            <div class="data-card">
                <h3 class="subsection-title">服务策略建议</h3>
                <ul>
                    <li><strong>已婚会员：</strong> 设计家庭导向的产品和服务，如家庭套餐、亲子活动等</li>
                    <li><strong>未婚会员：</strong> 推出个性化、时尚化的产品和服务，吸引关注和参与</li>
                    <li><strong>其他状态：</strong> 进行更细致的分类分析，提供针对性服务</li>
                </ul>
            </div>
        </div>

        <div class="report">
            <h2 class="section-title" id="union">5. 工会分布</h2>
            
            <div class="chart-container">
                <canvas id="unionChart"></canvas>
            </div>
            
            <div class="key-finding">
                <strong>关键发现：</strong> 电子与信息工程学院分工会会员最多(34人)，水文与水资源工程学院最少(5人)，呈现明显分布不均。
            </div>
            
            <div class="data-card">
                <h3 class="subsection-title">分布特征</h3>
                <ul>
                    <li><strong>头部工会：</strong> 电子与信息工程学院、人工智能学院和大气科学学院分工会会员数量均超过28人</li>
                    <li><strong>中部工会：</strong> 计算机学院、自动化学院等工会会员数量在20-28人之间</li>
                    <li><strong>尾部工会：</strong> 艺术学院、总务处等工会会员数量不足10人</li>
                </ul>
            </div>
            
            <div class="data-card warning">
                <h3 class="subsection-title">改进建议</h3>
                <ul>
                    <li>增强尾部工会的吸引力，开展更多活动提升参与度</li>
                    <li>根据工会规模合理分配资源，确保均衡发展</li>
                </ul>
            </div>
        </div>

        <div class="report">
            <h2 class="section-title" id="group">6. 小组分布</h2>
            
            <div class="chart-container">
                <canvas id="groupChart"></canvas>
            </div>
            
            <div class="key-finding">
                <strong>关键发现：</strong> "未知"小组占比最高(53人)，"两办行政"(41人)和"自动化系"(13人)紧随其后，呈现明显长尾效应。
            </div>
            
            <div class="data-card danger">
                <h3 class="subsection-title">数据问题</h3>
                <p>"未知"小组占比显著，可能表明部分会员的小组信息未及时更新或存在数据录入问题，建议优先核实数据完整性。</p>
            </div>
            
            <div class="data-card">
                <h3 class="subsection-title">优化建议</h3>
                <ul>
                    <li>针对会员数量较多的小组("两办行政"和"自动化系")，增加资源投入</li>
                    <li>对于会员数量较少的小组，考虑进行整合或重新分配</li>
                </ul>
            </div>
        </div>

        <div class="report">
            <h2 class="section-title" id="institution">7. 机构分布</h2>
            
            <div class="chart-container">
                <canvas id="institutionChart"></canvas>
            </div>
            
            <div class="key-finding">
                <strong>关键发现：</strong> 计算机学院(28人)、自动化学院(27人)和文学院(23人)会员最多，部分机构如科技产业处、研究生院等仅有1名会员。
            </div>
            
            <div class="data-card">
                <h3 class="subsection-title">分布特征</h3>
                <p>会员数量呈现明显的长尾分布，少数机构集中了大部分会员，多数机构会员数量较少，反映了机构规模或会员参与度的差异。</p>
            </div>
            
            <div class="data-card">
                <h3 class="subsection-title">运营建议</h3>
                <ul>
                    <li>重点关注会员数量较多的机构，优化资源分配和活动策划</li>
                    <li>针对会员数量较少的机构，增加宣传和参与机会</li>
                </ul>
            </div>
        </div>
    </div>

    <script>
        // 初始化图表
        document.addEventListener('DOMContentLoaded', function() {
            // 性别分布图表
            new Chart(document.getElementById('genderChart'), {
                type: 'pie',
                data: {
                    labels: ['男性 61.12%', '女性 38.88%'],
                    datasets: [{
                        data: [61.12, 38.88],
                        backgroundColor: ['#1a73e8', '#e53935'],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    plugins: {
                        title: {
                            display: true,
                            text: '会员性别分布',
                            font: { size: 16 }
                        },
                        legend: { position: 'right' },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return context.label + ': ' + context.raw + '%';
                                }
                            }
                        }
                    },
                    animation: {
                        animateScale: true,
                        animateRotate: true
                    }
                }
            });

            // 年龄分布图表
            new Chart(document.getElementById('ageChart'), {
                type: 'bar',
                data: {
                    labels: ['19-30岁', '31-45岁', '46-60岁', '60岁以上'],
                    datasets: [{
                        label: '占比 (%)',
                        data: [24.4, 48.0, 25.8, 1.6],
                        backgroundColor: [
                            'rgba(75, 192, 192, 0.7)',
                            'rgba(54, 162, 235, 0.7)',
                            'rgba(153, 102, 255, 0.7)',
                            'rgba(255, 159, 64, 0.7)'
                        ],
                        borderColor: [
                            'rgba(75, 192, 192, 1)',
                            'rgba(54, 162, 235, 1)',
                            'rgba(153, 102, 255, 1)',
                            'rgba(255, 159, 64, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    scales: {
                        y: {
                            beginAtZero: true,
                            max: 100,
                            ticks: {
                                callback: function(value) {
                                    return value + '%';
                                }
                            }
                        }
                    },
                    plugins: {
                        title: {
                            display: true,
                            text: '会员年龄分布',
                            font: { size: 16 }
                        },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return context.raw + '%';
                                }
                            }
                        }
                    },
                    animation: {
                        duration: 2000
                    }
                }
            });

            // 学历层次图表
            new Chart(document.getElementById('educationChart'), {
                type: 'doughnut',
                data: {
                    labels: ['博士研究生 65.93%', '硕士研究生 25.25%', '本科及以下 8.82%'],
                    datasets: [{
                        data: [65.93, 25.25, 8.82],
                        backgroundColor: [
                            'rgba(41, 121, 255, 0.7)',
                            'rgba(29, 233, 182, 0.7)',
                            'rgba(255, 152, 0, 0.7)'
                        ],
                        borderColor: [
                            'rgba(41, 121, 255, 1)',
                            'rgba(29, 233, 182, 1)',
                            'rgba(255, 152, 0, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    plugins: {
                        title: {
                            display: true,
                            text: '会员学历层次分布',
                            font: { size: 16 }
                        },
                        legend: { position: 'right' },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return context.label + ': ' + context.raw + '%';
                                }
                            }
                        }
                    },
                    cutout: '60%',
                    animation: {
                        animateScale: true,
                        animateRotate: true
                    }
                }
            });

            // 婚姻状态图表
            new Chart(document.getElementById('marriageChart'), {
                type: 'pie',
                data: {
                    labels: ['已婚 59.2%', '未婚 37.8%', '其他 3%'],
                    datasets: [{
                        data: [59.2, 37.8, 3],
                        backgroundColor: [
                            'rgba(63, 81, 181, 0.7)',
                            'rgba(233, 30, 99, 0.7)',
                            'rgba(255, 193, 7, 0.7)'
                        ],
                        borderColor: [
                            'rgba(63, 81, 181, 1)',
                            'rgba(233, 30, 99, 1)',
                            'rgba(255, 193, 7, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    plugins: {
                        title: {
                            display: true,
                            text: '会员婚姻状态分布',
                            font: { size: 16 }
                        },
                        legend: { position: 'right' },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return context.label + ': ' + context.raw + '%';
                                }
                            }
                        }
                    },
                    animation: {
                        animateScale: true,
                        animateRotate: true
                    }
                }
            });

            // 工会分布图表
            new Chart(document.getElementById('unionChart'), {
                type: 'bar',
                data: {
                    labels: ['电子与信息工程学院', '人工智能学院', '大气科学学院', '计算机学院', '自动化学院', '艺术学院', '水文与水资源工程学院'],
                    datasets: [{
                        label: '会员人数',
                        data: [34, 30, 28, 25, 22, 8, 5],
                        backgroundColor: 'rgba(26, 115, 232, 0.7)',
                        borderColor: 'rgba(26, 115, 232, 1)',
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    indexAxis: 'y',
                    scales: {
                        x: { beginAtZero: true }
                    },
                    plugins: {
                        title: {
                            display: true,
                            text: '工会会员数量分布',
                            font: { size: 16 }
                        }
                    },
                    animation: {
                        duration: 2000
                    }
                }
            });

            // 小组分布图表
            new Chart(document.getElementById('groupChart'), {
                type: 'bar',
                data: {
                    labels: ['未知', '两办行政', '自动化系', '计算机系', '其他小组'],
                    datasets: [{
                        label: '会员人数',
                        data: [53, 41, 13, 8, 85],
                        backgroundColor: 'rgba(234, 67, 53, 0.7)',
                        borderColor: 'rgba(234, 67, 53, 1)',
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    indexAxis: 'y',
                    scales: {
                        x: { beginAtZero: true }
                    },
                    plugins: {
                        title: {
                            display: true,
                            text: '小组会员数量分布',
                            font: { size: 16 }
                        }
                    },
                    animation: {
                        duration: 2000
                    }
                }
            });

            // 机构分布图表
            new Chart(document.getElementById('institutionChart'), {
                type: 'bar',
                data: {
                    labels: ['计算机学院', '自动化学院', '文学院', '艺术学院', '科技产业处', '研究生院'],
                    datasets: [{
                        label: '会员人数',
                        data: [28, 27, 23, 15, 1, 1],
                        backgroundColor: 'rgba(52, 168, 83, 0.7)',
                        borderColor: 'rgba(52, 168, 83, 1)',
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    indexAxis: 'y',
                    scales: {
                        x: { beginAtZero: true }
                    },
                    plugins: {
                        title: {
                            display: true,
                            text: '机构会员数量分布',
                            font: { size: 16 }
                        }
                    },
                    animation: {
                        duration: 2000
                    }
                }
            });
        });

        // 工具函数
        function scrollToContent() {
            document.querySelector('.container').scrollIntoView({ behavior: 'smooth' });
        }

        function scrollToTop() {
            window.scrollTo({ top: 0, behavior: 'smooth' });
        }

        function toggleToc() {
            const toc = document.getElementById('toc');
            toc.style.display = toc.style.display === 'block' ? 'none' : 'block';
        }

        // 显示目录按钮的滚动事件
        window.addEventListener('scroll', function() {
            const toc = document.getElementById('toc');
            if (window.scrollY > 300) {
                toc.style.display = 'block';
            } else {
                toc.style.display = 'none';
            }
        });

        // 导出PDF功能
        function exportToPDF() {
            const { jsPDF } = window.jspdf;
            const doc = new jsPDF('p', 'pt', 'a4');
            const options = {
                scale: 2,
                useCORS: true,
                allowTaint: true,
                logging: true,
                letterRendering: true
            };

            // 封面
            html2canvas(document.getElementById('cover'), options).then(canvas => {
                const imgData = canvas.toDataURL('image/png');
                doc.addImage(imgData, 'PNG', 0, 0, doc.internal.pageSize.getWidth(), doc.internal.pageSize.getHeight());
                doc.addPage();

                // 报告内容
                const reports = document.querySelectorAll('.report');
                let promise = Promise.resolve();
                
                reports.forEach((report, index) => {
                    promise = promise.then(() => {
                        return html2canvas(report, options).then(canvas => {
                            const imgData = canvas.toDataURL('image/png');
                            doc.addImage(imgData, 'PNG', 20, 20, doc.internal.pageSize.getWidth() - 40, 0);
                            if (index < reports.length - 1) {
                                doc.addPage();
                            }
                        });
                    });
                });

                return promise;
            }).then(() => {
                doc.save('会员综合分析报告.pdf');
            });
        }
    </script>
</body>
</html>